-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiDataGrid] Fixed focus ring to be contained in cell #5194
[EuiDataGrid] Fixed focus ring to be contained in cell #5194
Conversation
@@ -13,6 +13,7 @@ | |||
position: relative; | |||
align-items: center; | |||
display: flex; | |||
overflow: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could tell, the cell contents itself already has overflow: hidden
so I doubt this should have an impact. It certainly should not with the normal/default settings.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5194/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM! I tested in Chrome, FF & Safari (there were some other quirks but not related to this PR). So glad to have this fixed!
&::after { | ||
content: ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I was worried about adding a pseudo element because I was told that extra elements can impact the performance, but because this is only add on focus it doesn't seem to have an impact. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ that I'm not overly concerned about the performance and I think this is just fine, but wanted to add that we can use an inset box-shadow to get a border inside (vs. outside) the cell if it ever becomes a perf issue: CodeSandbox demo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @constancecchen! 🎉
At some point, I added the inset box-shadow
to the cell. But then I couldn't use a border-radius
because the cell has some light gray non-rounded borders. Then I just decided to add a pseudo-element. So this way we can have a rounded focus ring inside the non-rounded cell. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh right, makes sense if we want that border-radius!
@@ -13,6 +13,7 @@ | |||
position: relative; | |||
align-items: center; | |||
display: flex; | |||
overflow: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could tell, the cell contents itself already has overflow: hidden
so I doubt this should have an impact. It certainly should not with the normal/default settings.
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Preview documentation changes for this PR: https://eui.elastic.co/pr_5194/ |
Summary
This PR fixes the EuiDataGrid focus ring to be contained in the cell. It also fixes cells when focused getting a higher
z-index
which was causing long content to overlap surrounding cells.The issue with the focus states was found on #4958.
Why contained focus rings?
As we can see having the focus rings outside of the cells was making them getting cut by other surrounding cells. IMO it was not looking good.
Checklist
[ ] Checked in mobile[ ] Props have proper autodocs and playground toggles[ ] Added documentation[ ] Checked Code Sandbox works for any docs examples[ ] Added or updated jest tests[ ] Checked for breaking changes and labeled appropriately